import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '付款单号',
    align:"center",
    dataIndex: 'code'
   },

   {
    title: '合同编号',
    align:"center",
    dataIndex: 'ph'
   },


   {
    title: '付款金额',
    align:"center",
    dataIndex: 'fkje'
   },
   {
    title: '付款日期',
    align:"center",
    sorter: true,
    dataIndex: 'fkDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '付款银行',
    align:"center",
    dataIndex: 'fkyh_dictText'
   },
   {
    title: '票据号码',
    align:"center",
    dataIndex: 'pjhm'
   },
   {
    title: '说明',
    align:"center",
    dataIndex: 'remark'
   },
   {
    title: '操作员',
    align:"center",
    dataIndex: 'userName'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "合同编号",
      field: 'ph',
      component: 'JInput',
      colProps: {span: 6},
 	},
     {
      label: "付款日期",
      field: "fkDate",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
      },
      colProps: {span: 6},
	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '付款单号',
    field: 'code',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入付款单号!'},
          ];
     },
  },
  {
    label: '合同编号',
    field: 'ph',
    component: 'Input',

  },


  {
    label: '付款金额',
    field: 'fkje',
    defaultValue: 0,
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入付款金额!'},
          ];
     },
  },
  {
    label: '付款日期',
    field: 'fkDate',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入付款日期!'},
          ];
     },
  },
  {
    label: '付款银行',
    field: 'fkyh',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"pay_bank"
     },
  },
  {
    label: '票据号码',
    field: 'pjhm',
    component: 'Input',
  },

  {
    label: '付款单据路径',
    field: 'fkdj',
    component: 'JUpload',
    helpMessage: '最多上传1个文件',
    componentProps: {
      maxCount: 1,
      bizPath: 'gcfk'
    },
  },

  {
    label: '说明',
    field: 'remark',
    component: 'Input',
  },
  {
    label: '操作员',
    field: 'userName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入操作员!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
